/* 
 * File:   ipd_piecewise_linear_function.h
 * Author: dima
 *
 * Created on 14 Январь 2015 г., 11:53
 */

#ifndef IPD_PIECEWISE_LINEAR_FUNCTION_H
#define	IPD_PIECEWISE_LINEAR_FUNCTION_H
#include <list>
namespace ipd
{
class ipd_img;

class ipd_piecewise_linear_function
{
public:
    ipd_piecewise_linear_function(ipd_img &img, int step_brightness = 15);
    void convert_image(ipd_img &convertible_image); //convert Image
    virtual ~ipd_piecewise_linear_function();
    inline int get_count_intervals(); //get number of intervals on the real line
    inline int get_count_points(); //get number of points on the real line
    void set_value(int index, double x, double y); //set value
    void get_value(int index, double &x, double &y); //get value
private:
    void delete_KB(); //delete coefficients of the line
    void create_equation(); //Creating an equation for direct interpolation values
    unsigned char normalization(double value);
    ipd_piecewise_linear_function(const ipd_piecewise_linear_function& orig);
    const int step;
    double* X; //X-axis values
    double* Y; //Y-axis values
    double* K;
    double* B;
    int count_intervals; // number of intervals on the real line
    int count_points; // number of points on the real line
    ipd_img &image;

};

int ipd_piecewise_linear_function::get_count_intervals()//get number of intervals on the real line
{
    return count_intervals;
}

int ipd_piecewise_linear_function::get_count_points() //get number of points on the real line
{
    return count_points;
}
}
#endif	/* IPD_PIECEWISE_LINEAR_FUNCTION_H */

